<template>
  <div>
    <el-form-item
      v-if="activeData.config.fileSize !== undefined"
      :label="$t('formgen.upload.fileSize')"
    >
      <el-input
        v-model.number="activeData.config.fileSize"
        :placeholder="$t('formgen.upload.fileSize')"
      >
        <template #append>
          <el-select
            v-model="activeData.config.sizeUnit"
            :style="{ width: '66px' }"
          >
            <el-option
              label="KB"
              value="KB"
            />
            <el-option
              label="MB"
              value="MB"
            />
            <el-option
              label="GB"
              value="GB"
            />
          </el-select>
        </template>
      </el-input>
    </el-form-item>
    <el-form-item :label="$t('formgen.upload.multiFile')">
      <el-switch v-model="activeData.multiple" />
    </el-form-item>
    <el-form-item :label="$t('formgen.upload.maxFile')">
      <el-input-number v-model="activeData.limit" />
    </el-form-item>
    <el-form-item>
      <template #label>
        <span>
          {{ $t("formgen.upload.openConversion") }}
          <el-tooltip
            class="item"
            :content="$t('formgen.upload.conversionDesc')"
            effect="dark"
            placement="top-start"
          >
            <el-icon><ele-QuestionFilled /></el-icon>
          </el-tooltip>
        </span>
      </template>
      <el-switch v-model="activeData.openConversion" />
    </el-form-item>
    <el-form-item
      v-if="activeData.openConversion"
      :label="$t('formgen.upload.imgQuality')"
    >
      <template #label>
        <span>
          {{ $t("formgen.upload.imgQuality") }}
          <el-tooltip
            class="item"
            :content="$t('formgen.upload.imgQualityDesc')"
            effect="dark"
            placement="top-start"
          >
            <el-icon><ele-QuestionFilled /></el-icon>
          </el-tooltip>
        </span>
      </template>

      <el-input-number
        v-model="activeData.conversionRatio"
        :min="0"
        :max="1"
        :step="0.1"
      />
    </el-form-item>
    <el-form-item :label="$t('formgen.upload.openCamera')">
      <template #label>
        <span>
          {{ $t("formgen.upload.openCamera") }}
          <el-tooltip
            class="item"
            :content="$t('formgen.upload.cameraDesc')"
            effect="dark"
            placement="top-start"
          >
            <el-icon>
              <ele-QuestionFilled />
            </el-icon>
          </el-tooltip>
        </span>
      </template>

      <el-switch v-model="activeData.openCamera" />
    </el-form-item>
    <el-form-item
      v-if="activeData.openCamera"
      :label="$t('formgen.upload.cameraTimeWatermark')"
    >
      <template #label>
        <span>
          {{ $t("formgen.upload.cameraTimeWatermark") }}
        </span>
      </template>

      <el-switch v-model="activeData.cameraWatermark" />
    </el-form-item>
  </div>
</template>

<script>
export default {
  name: "ConfigItemImageUpload",
  props: ["activeData"]
};
</script>
